/*
 * @Author       :
 * @Date         : 2022-01-27 21:23:11
 * @LastEditors  : Please set LastEditors
 * @LastEditTime : 2022-02-16 23:18:37
 * @Description  : 主题
 */
import { setItem, getItem } from '@/utils/storage'
import { MAIN_COLOR, DEFAULT_COLOR } from '@/constant'
import variables from '@/styles/variables.scss'

export default {
  namespaced: true,
  state: () => ({
    mainColor: getItem(MAIN_COLOR) || DEFAULT_COLOR,
    variables: variables
  }),
  mutations: {
    setMainColor(state, newColor) {
      state.mainColor = newColor
      state.variables.menuBg = newColor
      setItem(MAIN_COLOR, newColor)
    }
  },
  actions: {
  }
}
